// 保存用户信息
var userInfo = null;
$.ajax({
    url: '/user/queryUserMessage',
    type: 'get',
    // 同步
    async: false,
    success: function (res) {
        console.log(res);
        // 用户没有登录
        if (res.error && res.error == 400) {
            location.href = "login.html";
        }
        userInfo = res;
    }
});
$(function () {
    $('#logout').on('click', function () {
        $.ajax({
            type: "get",
            url: "/user/logout",
            success: function (res) {
                if (res.success) {
                    mui.toast('退出成功')
                    location.href = 'index.html'
                }
            }
        });
    })
    $('.userInfo').html(template('userTemp', userInfo))

})